package com.audi.activity;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.Spinner;
import android.widget.TextView;

import com.audi.R;

@SuppressLint("Registered")
public class BoxNamePlaceCardActivity extends Activity {
    Spinner mSpinnerPlacecard;
    ImageButton mMenusettingplacecard, mConTrolBoxPlaceCard,
	    mMenuListPlaceCard;
    TextView mNameBox;
    String[] mListChooseome = { "Home places", "Home Place 1", "Home Place 2" };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
	// TODO Auto-generated method stub
	super.onCreate(savedInstanceState);
	setContentView(R.layout.action_bar_place_card);
	mSpinnerPlacecard = (Spinner) findViewById(R.id.homeplace);
	mSpinnerPlacecard.setAdapter(new Myadapter(this,
		R.layout.row_spiner_placecard, mListChooseome));

	/*
	 * ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,
	 * android.R.layout.simple_spinner_item, data);
	 * 
	 * dataAdapter
	 * .setDropDownViewResource(android.R.layout.simple_spinner_item);
	 * mSpinnerPlacecard.setAdapter(dataAdapter);
	 */
	// addListenerOnSpinnerItemSelection();

    }

    public class Myadapter extends ArrayAdapter<String> {
	public Myadapter(Context context, int textViewResourceId,
		String[] objects) {
	    super(context, textViewResourceId, objects);
	}

	@Override
	public View getDropDownView(int position, View convertView,
		ViewGroup parent) {
	    return getCustomView(position, convertView, parent);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
	    return getCustomView(position, convertView, parent);
	}

	public View getCustomView(int position, View convertView,
		ViewGroup parent) {

	    LayoutInflater inflater = getLayoutInflater();
	    View row = inflater.inflate(R.layout.row_spiner_placecard, parent,
		    false);
	    TextView mainText = (TextView) row
		    .findViewById(R.id.row_spiner_placecard);
	    mainText.setText(mListChooseome[position]);

	    return row;
	}

    }

}
